#!/bin/bash

prj=$1


echo "create repo ${prj} ..."
../gitlab.sh ${prj}

pushd ${prj}

git remote add gitlab git@hizon.asuscomm.com:hitmoon/${prj}.git

git br -a | grep -v '\->' | grep ' *origin/' | while read remote
do
  b=${remote##*origin/}
  c=${remote##*remotes/}
  git branch | grep -q "$b"
  if [ "$?" -ne 0 ]; then
	git checkout -b "$b" "$c"
  fi
done

git push gitlab --all
popd
echo "Done!"
